# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
# Contributor: Jonne Haß <me@jhass.eu>

pkgname=shards
pkgver=0.17.3
pkgrel=2
pkgdesc='The package manager for the Crystal language'
arch=(loong64 x86_64)
url='https://github.com/crystal-lang/shards'
license=(Apache)
depends=(libyaml git libevent gc pcre2)
makedepends=(crystal)
checkdepends=(git mercurial fossil)
source=(shards-$pkgver.tar.gz::https://github.com/crystal-lang/shards/archive/v$pkgver.tar.gz)
sha256sums=('6512ff51bd69057f4da4783eb6b14c29d9a88b97d35985356d1dc644a08424c7')

build() {
  cd shards-$pkgver
  CRYSTAL_OPTS="--release" make
}

check() {
  cd shards-$pkgver

  # remove git config settings once https://github.com/crystal-lang/shards/issues/430 is fixed
  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"
  git config --global column.ui always

  make test -j1 # -j1 is due to race condition in test code
}

package() {
  cd shards-$pkgver
  PREFIX=/usr DESTDIR="$pkgdir" make install
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
